

    const testApiService = require('../service/testApiService.js')

    module.exports = {

        newsInfo: async (ctx, next) => {
            try {
                const newsid = ctx.params.id
                if(!isNaN(newsid)) {
                    const result = await testApiService.checknewsinfo(newsid)
                    if(result) {
                        ctx.body = {
                            success: true,
                            err: {code: 1, msg: '获取新闻列表成功'},
                            data: result
                        }
                    }
                    else {
                        ctx.body = {
                            success: false,
                            err: {code: 0, msg: '获取新闻列表参数错误，获取失败！'}
                        }
                    }
                }
            } catch (e) {
                console.log(e)
                ctx.body = {
                    success: false,
                    err: {code: 0, msg: '获取新闻列表失败！'}
                }
            }
        },

    }